home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Communication / NewsBase / Source / IIOmodule.m < prev    next >
Text File  |  1993-01-12  |  3KB  |  86 lines

  1. //
  2. // IIOmodule is an abstract super class for IO modules for accessing a database.
  3. // The items in a database is organized heirarchly into a directory tree.  A
  4. // directory is permitted to have both subdirectories and items.  A IO module
  5. // supports a standard interface to a browser.  This permits the same browser
  6. // to be used with different types of databases provided that the database can 
  7. // be organized into a directory tree.  This standard interface is specified
  8. // by having the IIOmodule support the following methods:
  9. //
  10. //    (IOrderedListD *)subDirectoryOf:directoryNode
  11. //        This method should return a list of nodes that corresponds to the
  12. //        subdirectories of the directory that corresponds to the node 
  13. //        directoryNode.  The ownership of the list of nodes passes to the
  14. //        caller.  A nil directoryNode indicates the root node.
  15. //
  16. //    (IOrderedListD *)itemHeadersOf:directoryNode
  17. //        This method should return a list of nodes that corresponds to the
  18. //        items of the directory that corresponds to the node of directoryNode.
  19. //        The ownership of the list of nodes passes to the caller.
  20. //
  21. //    (IOrderedListD *)itemOf:itemNode
  22. //        This method should return the item that corresponds to itemNode.
  23. //        This method should send a message to the the editor to display this
  24. //        item.  The ownership of the item passes to the caller.
  25. //
  26. // A node is a private object that corresponds to a directory or an item.
  27. // It should implement the following methods:
  28. //
  29. //    (const char *)titleForCell;
  30. //        This method should return the name of the directory or item that
  31. //        corresponds to this node.  This is used for the title of the
  32. //        corresponding browser cell.
  33. //
  34. //    (BOOL)isLeaf;
  35. //        This method indicates for a node that corresponds to a directory
  36. //        whether it has subdirectories or not.  TRUE if it has no
  37. //        subdirectories.
  38. //
  39. // A node should save in its private instance variables the links to its
  40. // corresponding directory object or item object.  This allows a uniform
  41. // interface to the browser module using the above methods but a custom
  42. // interface to the IO module using  private instance variables and methods.
  43. //
  44.  
  45. #import "IIOmodule.h"
  46. #import <string.h>
  47.  
  48. @implementation IIOmodule
  49.  
  50. - setRootName:(char *)rootName
  51. {
  52.     strncpy (iRootName, rootName, sizeof(iRootName)-1);
  53.     return self;
  54. }
  55.  
  56. - (char *)rootName
  57. {
  58.     return (iRootName);
  59. }
  60.  
  61. - (BOOL)toggleActive:node
  62. {
  63.     // this routine should be overriden
  64.     return YES;
  65. }
  66.  
  67. - subDirectoryOf:node
  68. {
  69.     // this routine should be overriden
  70.     return self;
  71. }
  72.  
  73. - itemHeadersOf:node
  74. {
  75.     // this routine should be overriden
  76.     return self;
  77. }
  78.  
  79. - itemOf:node
  80. {
  81.     // this routine should be overriden
  82.     return self;
  83. }
  84.  
  85. @end
  86.